package top.kindaries.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Calendar;
import java.util.Date;
import java.util.List;

/**
 * Jira信息表
 *
 * @ClassName: JiraInfo
 * @Author: zhangs
 * @Date: Created in 2021-05-18 14:55
 * @Created by IntelliJ IDEA.
 */
@ApiModel("jira_info")
public class JiraInfo extends BasicsPageInfo {

    @ApiModelProperty("jira号")
    private String jiraId;

    @ApiModelProperty("概要")
    private String outline;

    @ApiModelProperty("交付日期")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date deliveryDate;

    @ApiModelProperty("状态")
    private String jiraState;

    @ApiModelProperty("解决结果")
    private String results;

    @ApiModelProperty("计划工时")
    private Integer plannedWorkload;

    @ApiModelProperty("实际工时")
    private Integer actualWorkload;

    @ApiModelProperty("是否为bug")
    private Integer isBug;

    private Integer mouth;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date startDate;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date endDate;

    private String resultFilter;

    public String getJiraId() {
        return jiraId;
    }

    public void setJiraId(String jiraId) {
        this.jiraId = jiraId;
    }

    public String getOutline() {
        return outline;
    }

    public void setOutline(String outline) {
        this.outline = outline;
    }

    public Date getDeliveryDate() {
        return deliveryDate;
    }

    public void setDeliveryDate(Date deliveryDate) {
        this.deliveryDate = deliveryDate;
    }

    public String getJiraState() {
        return jiraState;
    }

    public void setJiraState(String jiraState) {
        this.jiraState = jiraState;
    }

    public String getResults() {
        return results;
    }

    public void setResults(String results) {
        this.results = results;
    }

    public Integer getPlannedWorkload() {
        if (plannedWorkload == null) return 8;
        return plannedWorkload;
    }

    public void setPlannedWorkload(Integer plannedWorkload) {
        this.plannedWorkload = plannedWorkload;
    }

    public Integer getActualWorkload() {
        if (actualWorkload == null) return getPlannedWorkload();
        return actualWorkload;
    }

    public void setActualWorkload(Integer actualWorkload) {
        this.actualWorkload = actualWorkload;
    }

    public Integer getIsBug() {
        return isBug;
    }

    public void setIsBug(Integer isBug) {
        this.isBug = isBug;
    }

    public Integer getMouth() {
        if (this.deliveryDate == null) return null;
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(this.deliveryDate);
        return calendar.get(Calendar.MONTH);//第几个月
    }

    public void setMouth(Integer mouth) {
        this.mouth = mouth;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public String getResultFilter() {
        return resultFilter;
    }

    public void setResultFilter(String resultFilter) {
        this.resultFilter = resultFilter;
    }

}
